/**
 * 
 */
package net.smartlab.android.callmanager.services;

import net.smartlab.android.callmanager.R;
import android.app.Service;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;
import android.util.Log;
import android.widget.Toast;

/**
 * @author placava
 *
 */
public class MusicService extends Service{
	
	private static final String TAG = "MusicService";
	MediaPlayer player;
	/* (non-Javadoc)
	 * @see android.app.Service#onCreate()
	 */
	@Override
	public void onCreate() {
		// TODO Auto-generated method stub
		super.onCreate();
		player = MediaPlayer.create(this, R.raw.ac_dc);
		player.setLooping(false); // Set looping
	}

	/* (non-Javadoc)
	 * @see android.app.Service#onDestroy()
	 */
	@Override
	public void onDestroy() {
		Toast.makeText(this, "MusicService Stopped", Toast.LENGTH_LONG).show();
		Log.d(TAG, "onDestroy");
		player.stop();
	}

	/* (non-Javadoc)
	 * @see android.app.Service#onStart(android.content.Intent, int)
	 */
	@Override
	public void onStart(Intent intent, int startId) {
		Toast.makeText(this, "MusicService Started", Toast.LENGTH_LONG).show();
		Log.d(TAG, "onStart");
		player.start();
	}

	/* (non-Javadoc)
	 * @see android.app.Service#onBind(android.content.Intent)
	 */
	@Override
	public IBinder onBind(Intent intent) {
		// TODO Auto-generated method stub
		return null;
	}

	
	
	

}
